package com.example.demo.config;

import java.util.Properties;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PerformanceInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

@Configuration
public class MybatisPlusConfig {

	/**
         * 分页插件，自动识别数据库类型     
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
    	 return new PaginationInterceptor();
    } 
    
    /**
        * 打印 sql
    */
    @Bean
    public PerformanceInterceptor performanceInterceptor() {

        PerformanceInterceptor performanceInterceptor =new PerformanceInterceptor();

        //格式化sql语句
        Properties properties =new Properties();
        properties.setProperty("format", "faalse");
        performanceInterceptor.setProperties(properties);

        return performanceInterceptor;

    }
	
}
